package cn.accp.bookShop.entity;

//图书类
public class Book {
	// 编号
	private int id;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	// 书名
	private String title;

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	// 单价
	private double price;

	public double getPrice() {
		return price;
	}

	public void setPrice(double price) {
		if (price > 0) {
			this.price = price;
		}
	}

	// 出版社
	private String publisher;

	public String getPublisher() {
		return publisher;
	}

	public void setPublisher(String publisher) {
		this.publisher = publisher;
	}

	public Book() {
	}

	public Book(int id, String title, double price, String publisher) {
		this.id = id;
		this.title = title;
		setPrice(price);
		this.publisher = publisher;
	}


	// 显示信息
	public void showMe() {
		String infoString = this.id + "\t" + this.title + "\t" + this.price
				+ "\t" + this.publisher;
		System.out.println(infoString);
	}
}
